package com.candy.candyuser.model.entity;

import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.candy.candycommon.annotation.PrivacyEncrypt;
import com.candy.candycommon.enums.PrivacyTypeEnum;
import com.candy.candyuser.extend.EncryptTransaction;
import com.candy.candyuser.extend.SensitiveData;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * </p>
 *
 * @author suyanlong
 * @since 2022-10-25
 */
@Data
@TableName("user")
@SensitiveData
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    private String name;

    @EncryptTransaction
    @PrivacyEncrypt(type = PrivacyTypeEnum.ID_CARD)
    private String cardNo;

    @EncryptTransaction
    @PrivacyEncrypt(type = PrivacyTypeEnum.PHONE)
    private String phone;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;

    @Override
    public String toString() {
        return "LogLink{" +
                "id=" + id +
                ", name=" + name +
                ", cardNo=" + cardNo +
                ", phone=" + phone +
                ", createTime=" + createTime +
                "}";
    }

}
